package com.mes.check.dao;

import org.springframework.stereotype.Repository;

import com.mes.check.dao.iface.IDefectJudgeDetailDao;
import com.mes.check.domain.DefectJudgeDetail;
import com.mes.common.dao.BasicDao;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
import org.hibernate.Session;

@Repository
public class DefectJudgeDetailDao extends BasicDao<DefectJudgeDetail> implements IDefectJudgeDetailDao{
	private static final Log log = LogFactory.getLog(DefectJudgeDetailDao.class);
	
	@Override
	public List<DefectJudgeDetail> getDefectJudgeDetailByRelationBillUid(String relationBillUid)
			throws Exception {
		List list=null;
		try {
			log.debug("++++++++++++++++++++++++++++++++++++getDefectJudgeDetailByRelationBillUid");
			Session session=this.getSession();
			StringBuilder hql=new StringBuilder();
			hql.append(" from " + this.getClass().getName() + " where ");
			hql.append( " relationbilluid=? ");
			Query query = session.createQuery(hql.toString());
			query.setString(0, relationBillUid);

			list = query.list();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}

	@Override
	public List<DefectJudgeDetail> getDefectJudgeDetailByJudgeUid(
			String judgeUid) throws Exception {
		List list=null;
		try {

			Session session=this.getSession();
			StringBuilder hql=new StringBuilder();
			hql.append(" from " + this.getClass().getName() + " where ");
			hql.append( " defectJudgeUid=? ");
			Query query = session.createQuery(hql.toString());
			query.setString(0, judgeUid);

			list = query.list();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	

}
